<?php
include ("../../inc/global.inc");
include("../islogin.php");
$url="index_2.php";
$thepage=$_GET['page']?$_GET['page']:1;
$maxpage=20;
if($_GET['del_act']){
$urls=$_SERVER['HTTP_REFERER'];
mysql_query("delete from tel where id='".$_GET['del_id']."'");
echo "<script>location='".$urls."';</script>";
}
?>
<HTML>
<HEAD>
<TITLE>admin</TITLE>
<META http-equiv=Content-Type content="text/html; charset=utf-8">
<LINK href="../css/css.css" rel=stylesheet>
<script type='text/javascript' src="../js/islogin.js" charset="gb2312"></script>
</HEAD>
<BODY>
<center>
  <table width="80%" border="0" cellpadding="0" cellspacing="1" bgcolor="#000000">
    <tr>
      <td height="25" bgcolor="#EEEEF9" style="padding-left:5px;">已处理400电话&nbsp;&nbsp;<a href="javascript:history.go(-1)">返回</a></td>
    </tr>
  </table>
<table width="80%" border="0" cellspacing="0" cellpadding="0">
    <form method="post" action="<?=$url?>">
      <tr>
        <td height="50" style="line-height:22px;"><font color="blue">高级搜索：</font>
          <input name="search_name" type="text" size="25">&nbsp;(联系人，联系手机，联系电话，联系人qq)
          &nbsp;&nbsp;&nbsp;
          <input name="submit" type="submit" value="搜索"></td>
      </tr>
      <input type="hidden" name="search_act" value="ok">
    </form>
  </table>
<?php 
if($_POST[search_name]){
$search_sql=" and (m_people='$_POST[search_name]' or m_tel='$_POST[search_name]' or m_phone='$_POST[search_name]' or m_qq='$_POST[search_name]')";
}
?><table width="80%" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#000000" > 
	<tr align='center' bgcolor='#D8EAF4'>
	<td width="6%" height="30" nowrap bgcolor="#8DA8CF" class='category'>序号</td>
	<td width="14%" nowrap bgcolor="#8DA8CF" class='category'>账号</td>
	<td width="12%" nowrap bgcolor="#8DA8CF" class='category'>联系人</td>
	<td width="12%" nowrap bgcolor="#8DA8CF" class='category'>联系电话</td>
	<td width="11%" nowrap bgcolor="#8DA8CF" class='category'>手机</td>
	<td width="14%" nowrap bgcolor="#8DA8CF" class='category'>QQ(MSN)</td>
	<td width="19%" nowrap bgcolor="#8DA8CF" class='category'>时间</td>
	<td width="12%" nowrap bgcolor="#8DA8CF" class='category'>操作</td>
	</tr>
<?php
$sql="SELECT * FROM tel  where is_cl=1 ".$search_sql." order by id desc limit ".($thepage-1)*$maxpage.",$maxpage";
$rs=mysql_query($sql);
$i=1;
while($row=mysql_fetch_array($rs)){
$color=($i%2)?"#FFFFFF":"#eeeeee";
?>
<tr align='center' bgcolor=<?=$color?>>
<td height="25" align="center"><?=$i?></td>
<td align="center">
<?php if($row[member_id]){
   $m_rs=@mysql_query("select m_user from member where id='".$row['member_id']."'");
   $m_row=@mysql_fetch_array($m_rs);
   echo $m_row[m_user];
   }else{
   echo "非会员提交";
   }
?></td>
<td align="center"><?=$row['m_people']?></td>
<td align="center"><?=$row['m_tel']?></td>
<td align="center"><?=$row['m_phone']?></td>
<td align="center"><?=$row['m_qq']?></td>
<td align="center"><?php if($row[add_time]>=date("Y-m-d")){?><font color="#FF0000"><?=date("Y-m-d H:i",strtotime($row[add_time]))?></font><?php }else{?><?=date("Y-m-d H:i",strtotime($row[add_time]))?><?php }?></td>
<td align="center"><a href="index_modify.php?xg_id=<?=$row['id']?>">编辑</a>&nbsp;&nbsp;|&nbsp;&nbsp;<a href="<?=$url?>?del_act=ok&del_id=<?=$row['id']?>" onClick="return del()">删除</a></td>
</tr>
<?php
$i++;
}
$totalrecord=mysql_num_rows(mysql_query("SELECT * FROM tel where is_cl=1 ".$search_sql));
$totalpage=ceil($totalrecord/$maxpage);
?>
    <tr><form method="get" action="<?=$url?>">
       <td height="31" colspan="8" align="center" bgcolor="#FFFFFF">
	   <?php if($thepage>1){?>
	   <a href="<?=$url?>">第一页</a>&nbsp;<a href="<?=$url?>?page=<?=$thepage-1?>">上一页</a>
	   <?php }?>
	   <?php if($thepage!=$totalpage&&$totalpage>1){?>
	   <a href="<?=$url?>?page=<?=$thepage+1?>">下一页</a>&nbsp;<a href="<?=$url?>?page=<?=$totalpage?>">最后一页</a>
      <?php }?>【共<font color="red"><?=$totalrecord?></font>条记录】【每页<font color="red"><?=$maxpage?></font>条记录】【共<font color="red"><?=$totalpage?></font>页】      </td></form>
	</tr>
</table>
</center>
</BODY>
</HTML>

